﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace WebNote.Modules
{
    /// <summary>
    /// 分类
    /// </summary>
    public class Category
    {
        /// <summary>
        /// 根结点ID
        /// </summary>
        public const int RootCategoryId = 0;

        /// <summary>
        /// 分类ID
        /// </summary>
        public int CategoryId { get; set; }

        /// <summary>
        /// 父级分类ID
        /// </summary>
        public int ParentCategoryId { get; set; }

        /// <summary>
        /// 分类名称
        /// </summary>
        public string CategoryName { get; set; }

        /// <summary>
        /// 创建时间
        /// </summary>
        public long CreateTime { get; set; }

        /// <summary>
        /// 排序号
        /// </summary>
        public int SortId { get; set; }

        /// <summary>
        /// 当前节点下文档数量
        /// </summary>
        public long DocumentCount { get; set; }

        /// <summary>
        /// 总文档数量
        /// </summary>
        public long TotalDocumentCount { get; set; }

        /// <summary>
        /// 是否有子类
        /// </summary>
        /// <returns></returns>
        public bool HasChild()
        {
            return true;
        }

        /// <summary>
        /// 获取所有的子类
        /// </summary>
        /// <returns></returns>
        public List<Category> GetAllChild()
        {
            List < Category > childs = new List<Category>();
            if (HasChild())
            {
                
            }
            return childs;
        }

        public bool AddChild()
        {
            return true;
        }

        public bool RemoveChild()
        {
            return true;
        }

        public List<Document> GetAllDocument()
        {
            return new List<Document>();
        }
    }
}
